let success = `background-color: #f0f9eb;border-color: #e1f3d8;color: #67c23a;  padding: 1px 8px; border-radius: 4px; border-style: solid; border-width: 1px;white-space: nowrap; display: inline-block;`
let error = `background-color: #fef0f0;border-color: #fde2e2;color: #f56c6c;padding: 1px 8px; border-radius: 4px; border-style: solid; border-width: 1px;white-space: nowrap; display: inline-block;`
let info = `background-color: #f4f4f5;border-color: #e9e9eb;
color: #909399;padding: 1px 8px; border-radius: 4px; border-style: solid; border-width: 1px;white-space: nowrap; display: inline-block;`
let primary = `background-color: #ecf5ff;border-color:#d9ecff;color: #409EFF;padding: 1px 8px; border-radius: 4px;border-style: solid; border-width: 1px;white-space: nowrap; display: inline-block;`
let warning = `background-color: #fdf6ec;border-color: #faecd8;color: #e6a23c;padding: 1px 8px; border-radius: 4px;border-style: solid; border-width: 1px;white-space: nowrap; display: inline-block;`
let unknown = `bbackground-color: #bcbf00;border-color:#e5e1c1;color: #71871e;padding: 1px 8px; border-radius: 4px;border-style: solid; border-width: 1px;white-space: nowrap; display: inline-block;`

export class Status {
  /**
   * 枚举列表
   * @param id 对应状态的id
   * @param option 对应状态选项数组
   */
  orderStatus(id, option) {
    let list = option ? option : []
    let back = ''
    list.forEach(element => {
      if (element.id == id) {
        if (element.id == 1) {
          back = `<span style="${info}">${element.name}</span>`
        } else if (element.id == 3) {
          back = `<span style="${success}">${element.name}</span>`
        } else if (element.id == 9) {
          back = `<span style="${error}">${element.name}</span>`
        }else {
          back = element.name
        }
      }
    });
    return back
  }
  cardStatus(id, name) {
    let back = ''
    if (id == 1) {
      back = `<span style="${primary}">${name}</span>`
    } else if (id == 2) {
      back = `<span style="${warning}">${name}</span>`
    } else if (id == 3) {
      back = `<span style="${success}">${name}</span>`
    } else if (id == 4) {
      back = `<span style="${error}">${name}</span>`
    } else if (id == 5) {
      back = `<span style="${info}">${name}</span>`
    } else if (id == 9) {
      back = `<span style="${error}">${name}</span>`
    } else if (id == 11) {
      back = `<span style="${unknown}">${name}</span>`
    }else {
      back = name
    }
    return back
  }
  taskStatus(id, option) {
    let list = option ? option : []
    let back = ''
    list.forEach(element => {
      if (element.id == id) {
        if (element.id == 1) {
          back = `<span style="${primary}">${element.name}</span>`
        } else if (element.id == 2) {
          back = `<span style="${unknown}">${element.name}</span>`
        } else if (element.id == 10) {
          back = `<span style="${info}">${element.name}</span>`
        } else if (element.id == 3) {
          back = `<span style="${success}">${element.name}</span>`
        } else if (element.id == 4) {
          back = `<span style="${warning}">${element.name}</span>`
        } else if (element.id == 9) {
          back = `<span style="${error}">${element.name}</span>`
        }else {
          back = element.name
        }
      }
    });
    return back
  }
  status(id, option) {
    let list = option ? option : []
    let back = ''
    list.forEach(element => {
      if (element.id == id) {
        if (element.id == 4) {
          back = `<span style="${error}">${element.name}</span>`
        } else if (element.id == 3) {
          back = `<span style="${success}">${element.name}</span>`
        }else {
          back = element.name
        }
      }
    });
    return back
  }
}